package com.vcit.system.service.course.impl;

import java.util.Date;
import java.util.List;

import com.vcit.common.utils.DateUtils;
import com.vcit.common.utils.SecurityUtils;
import com.vcit.system.domain.course.TCourse;
import com.vcit.system.mapper.course.TCourseMapper;
import com.vcit.system.service.course.ITCourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 课程Service业务层处理
 * 
 * @author dff
 * @date 2025-01-08
 */
@Service
public class TCourseServiceImpl implements ITCourseService
{
    @Autowired
    private TCourseMapper tCourseMapper;

    /**
     * 查询课程
     * 
     * @param id 课程主键
     * @return 课程
     */
    @Override
    public TCourse selectTCourseById(Long id)
    {
        return tCourseMapper.selectTCourseById(id);
    }

    /**
     * 查询课程列表
     * 
     * @param tCourse 课程
     * @return 课程
     */
    @Override
    public List<TCourse> selectTCourseList(TCourse tCourse)
    {
        return tCourseMapper.selectTCourseList(tCourse);
    }

    /**
     * 新增课程
     * 
     * @param tCourse 课程
     * @return 结果
     */
    @Override
    public int insertTCourse(TCourse tCourse)
    {
        tCourse.setCreateBy(SecurityUtils.getUsername());
        tCourse.setCreateTime(DateUtils.getNowDate());
        return tCourseMapper.insertTCourse(tCourse);
    }

    /**
     * 修改课程
     * 
     * @param tCourse 课程
     * @return 结果
     */
    @Override
    public int updateTCourse(TCourse tCourse)
    {
        tCourse.setUpdateTime(DateUtils.getNowDate());
        tCourse.setUpdateBy(SecurityUtils.getUsername());
        return tCourseMapper.updateTCourse(tCourse);
    }

    /**
     * 批量删除课程
     * 
     * @param ids 需要删除的课程主键
     * @return 结果
     */
    @Override
    public int deleteTCourseByIds(Long[] ids)
    {
        return tCourseMapper.deleteTCourseByIds(ids);
    }

    /**
     * 删除课程信息
     * 
     * @param id 课程主键
     * @return 结果
     */
    @Override
    public int deleteTCourseById(Long id)
    {
        return tCourseMapper.deleteTCourseById(id);
    }
}
